package com.liming.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author liming
 * @date 2025/4/14
 */
@Getter
@AllArgsConstructor
public enum RefundAccountEnum {

    // 退款所使用资金对应的资金账户类型：
    //UNSETTLED: 未结算资金，
    //AVAILABLE: 可用余额，
    //UNAVAILABLE: 不可用余额，
    //OPERATION: 运营账户，
    //BASIC: 基本账户（含可用余额和不可用余额），
    //ECNY_BASIC: 数字人民币基本账户。

    UNSETTLED(1, "UNSETTLED", "未结算资金"),
    AVAILABLE(2, "AVAILABLE", "可用余额"),
    UNAVAILABLE(3, "UNAVAILABLE", "不可用余额"),
    OPERATION(4, "OPERATION", "运营账户"),
    BASIC(5, "BASIC", "基本账户"),
    ECNY_BASIC(6, "ECNY_BASIC", "数字人民币基本账户");

    private final Integer code;
    private final String name;
    private final String desc;

    public static Integer getCodeByName(String name) {
        for (RefundAccountEnum value : values()) {
            if (value.getName().equals(name)) {
                return value.getCode();
            }
        }
        return null;
    }
}
